<style>
	.text-value{
		text-align: left;
		width: 80%;
		word-break:break-all;
		white-space:pre-wrap;
		cursor:auto;
		float: left;
		display: block;
		padding: 9px 15px;
		font-weight: 400;
		line-height: 20px;
		position: relative;
	}
	.layuimini-form > .layui-form-item > .layui-form-label{
		width: 160px !important;
	}
</style>
<div class="layuimini-main">
	<div class="layui-form layuimini-form" lay-filter="form-data">
		<div class="layui-form-item">
			<label class="layui-form-label">模板编号：</label>
			<div class="layui-input-block">
				<label class="text-value" id="id"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">模板名称：</label>
			<div class="layui-input-block">
				<label class="text-value" id="templateName"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">环境名称：</label>
			<div class="layui-input-block">
				<label class="text-value" id="envName"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">环境标识：</label>
			<div class="layui-input-block">
				<label class="text-value" id="tag"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">集群名称：</label>
			<div class="layui-input-block">
				<label class="text-value" id="clusterName"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">集群命名空间：</label>
			<div class="layui-input-block">
				<label class="text-value" id="namespaceName"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">部署序号：</label>
			<div class="layui-input-block">
				<label class="text-value" id="deploymentOrder"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">最小副本数：</label>
			<div class="layui-input-block">
				<label class="text-value" id="minReplicas"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">最大副本数：</label>
			<div class="layui-input-block">
				<label class="text-value" id="maxReplicas"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">每副本CPU（m）：</label>
			<div class="layui-input-block">
				<label class="text-value" id="replicaCpu"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">每副本内存（MB）：</label>
			<div class="layui-input-block">
				<label class="text-value" id="replicaMemory"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">自动扩容CPU率（%）：</label>
			<div class="layui-input-block">
				<label class="text-value" id="autoScalingCpu"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">自动扩容内存率（%）：</label>
			<div class="layui-input-block">
				<label class="text-value" id="autoScalingMemory"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">部署审批：</label>
			<div class="layui-input-block">
				<label class="text-value" id="requiredDeployApproval"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">部署后合并代码：</label>
			<div class="layui-input-block">
				<label class="text-value" id="requiredMerge"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">服务端口：</label>
			<div class="layui-input-block">
				<label class="text-value" id="servicePort"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">辅助端口：</label>
			<div class="layui-input-block">
				<label class="text-value" id="minorPorts"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">健康检查路径：</label>
			<div class="layui-input-block">
				<label class="text-value" id="healthPath"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">创建时间：</label>
			<div class="layui-input-block">
				<label class="text-value" id="creationTime"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">修改时间：</label>
			<div class="layui-input-block">
				<label class="text-value" id="updateTime"></label>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">描述：</label>
			<div class="layui-input-block">
				<label class="text-value" id="description"></label>
			</div>
		</div>
	</div>
</div>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

		//初始化表单数据
		var loadIndex = 0;
		$.ajax({
			url: '/globalConfig/envTemplate/query',
			type: 'POST',
			dataType: "json",
			contentType: 'application/json;charset=UTF-8',
			data: JSON.stringify({'globalConfigId': JSON.parse(parent.data2).id}),
			beforeSend: function() {
				loadIndex = layer.load(2);
			},
			success: function(res){
				if(res.code != "000000"){
					layer.msg(res.message, {icon: 5, shift: 6});
					layer.close(loadIndex);
					return false;
				}
				var data = res.data.envTemplate;
				$("#id").text(data.id);
				$("#templateName").text(data.templateName);
				$("#clusterName").text(data.clusterName);
				$("#namespaceName").text(data.namespaceName);
				$("#envName").text(data.envName);
				$("#tag").text(data.tag);
				$("#deploymentOrder").text(data.deploymentOrder);
				$("#minReplicas").text(data.minReplicas);
				$("#maxReplicas").text(data.maxReplicas);
				$("#replicaCpu").text(data.replicaCpu);
				$("#replicaMemory").text(data.replicaMemory);
				$("#autoScalingCpu").text(data.autoScalingCpu);
				$("#autoScalingMemory").text(data.autoScalingMemory);
				if(data.requiredDeployApproval == 0){
					$("#requiredDeployApproval").text('否');
				}else{
					$("#requiredDeployApproval").text('是');
				}
				if(data.requiredMerge == 0){
					$("#requiredMerge").text('否');
				}else{
					$("#requiredMerge").text('是');
				}
				$("#servicePort").text(data.servicePort);
				$("#minorPorts").text(data.minorPorts);
				$("#healthPath").text(data.healthPath);
				$("#description").text(data.description);
				$("#creationTime").text(data.creationTime);
				$("#updateTime").text(data.updateTime);

				layer.close(loadIndex);
			},
			error: function(res){
				layer.close(loadIndex);
				layer.msg(res.message, {icon: 5, shift: 6});
			}
		});
    });
</script>